<!DOCTYPE html>
<html>
  <head>
	<?=getJsLink('jquery-1.8.2.js')?>
	<!-- Bootstrap -->
	<?=getJsLink('main.js')?>
	<?=getJsLink('md5.js')?>
	<?=getJsLink('bootstrap.min.js')?>
	<?=getCssLink('bootstrap.css')?>
	<?=getCssLink('normalize.css')?>
	<!-- User -->
	<?=getCssLink('abitur.css')?>

	<? if (isset($addingJS)) foreach($addingJS as $el) echo getJsLink($el); ?>
	<? if (isset($addingCSS)) foreach($addingCSS as $el) echo getCssLink($el); ?>

	<title><?=(!empty($title))? $title :'Главная страница'?></title>
  </head>
  <body>
  		<script>
			var base_url = "<?=base_url()?>";
			var hashId = "<?= !empty($_SESSION['hashId']) ? $_SESSION['hashId'] : '' ?>";
		</script>
	 <?if ($this->user->id()):?>	
	
	<div class="topbar">
		<div class="fill">
			<div class="container topMenu">
				<? $user = $_SESSION['userData'] ?>
					<?=$user->pFamily." ".$user->pName?>
				<div class="pull-right">
					<div class="nav">
						<?if ($user->tAccType == 0):?>
							<li class="up"><a href="<?=base_url()?>user/scores">Мои баллы</a></li>
						<?endif?>
						<li class="up"><a href="<?=base_url()?>user/logout">Выход</a></li>
					</div>
				</div>
			</div>
		</div>
	</div>
	<?endif?>

  	<div class="container">
  	<?if ($this->user->id()):?>
		<div class="row">
			<div class="navbar">
				<div class="span12">
				  <div class="navbar-inner">
				  	<div class="span5">
					    <ul class="nav">
					      <li class="active"><a href="<?=base_url()?>abiturient">Абитуриенты</a></li>
					      <li><span id="addAbiturient"><a href="<?=($user->tAccType == 0) ?  base_url().'abiturient/add' : '#'?>"> Добавить</a></span></li>
					    </ul>
				    </div>
				   
				    <?if ($user->tAccType != 0):?>
				    <div class="span6 pull-right">
						<form class="form-search pull-right" action="<?=base_url()?>abiturient/search" method="post">

							<input type="text" name="querySearch" class="input-medium search-query">
							<button type="submit" class="btn"><i class="icon-search"></i>&nbsp Поиск</button>
						</form>
					</div>
					<?endif?>
				  </div>
				</div>

			</div>
		</div>
	<?endif?>

  		<? if (!empty($_SESSION['saveAbitur']) || (!empty($_SESSION['error']))) : ?>
	  		<div class="row">
	  			<div class="span12">
	  			<?if (!empty($_SESSION['saveAbitur'])):?>
	  				<div class="alert alert-success"><?=$_SESSION['saveAbitur']?></div>
	  			<?endif?>
	  			<? if (!empty($_SESSION['error'])):?>
	  				<?
	  					if (!is_array($_SESSION['error']))
	  						$_SESSION['error'] = array($_SESSION['error']);
	  				?>
	  				<?foreach ($_SESSION['error'] as $error):?>
		  				<div class="alert alert-error">
							<?=$error?>
						</div>
					<?endforeach?>
				<?endif;?>
	  			</div>
	  		</div>
	  	<? 	$_SESSION['saveAbitur'] = NULL; 
	  		$_SESSION['error'] = NULL; 

	  	?>
  		<?endif?>
			
		<div class="row">
			<div class="span12">
				<?php echo !empty($content)? $content : ''?>
			</div>
		</div>
	</div>
  </body>
</html>
